package only.my.railgunys.artifact;

import only.my.railgunys.artifact.calc.SubStatRollCalc;

public enum ArtifactSub {
    flatHP(1,"值生命", SubStatRollCalc::upFlatHp,SubStatRollCalc::setFlatHp),
    flatATK(2,"值攻击", SubStatRollCalc::upFlatATK,SubStatRollCalc::setFlatATK),
    percentHP(3,"百分比生命", SubStatRollCalc::upPercentHP,SubStatRollCalc::setPercentHP),
    percentATK(4,"百分比攻击", SubStatRollCalc::upPercentATK,SubStatRollCalc::setPercentATK),
    percentDEF(5,"百分比防御", SubStatRollCalc::upPercentDEF,SubStatRollCalc::setPercentDEF),
    critRate(6,"暴击率", SubStatRollCalc::upCritRate,SubStatRollCalc::setCritRate),
    critDamage(7,"暴击伤害", SubStatRollCalc::upCritDamage,SubStatRollCalc::setCritDamage),
    elementalMastery(8,"精通", SubStatRollCalc::upElementalMastery,SubStatRollCalc::setElementalMastery),
    energyRecharge(9,"充能", SubStatRollCalc::upEnergyRecharge,SubStatRollCalc::setEnergyRecharge),
    flatDEF(10,"值防御", SubStatRollCalc::upFlatDEF,SubStatRollCalc::setFlatDEF);

    int code;
    PossibleUpgradeFunction possibleUpgradeFunction;
    SetValueFunction setValueFunction;
    String desc;

    ArtifactSub(int code, String desc, PossibleUpgradeFunction possibleUpgradeFunction,SetValueFunction setValueFunction) {
        this.code = code;
        this.desc = desc;
        this.possibleUpgradeFunction = possibleUpgradeFunction;
        this.setValueFunction = setValueFunction;
    }
    public static ArtifactSub initByCode(int code){
        switch (code){
            case 1 :
                return flatHP;
            case 2:
                return flatATK;
            case 3:
                return percentHP;
            case 4:
                return percentATK;
            case 5:
                return percentDEF;
            case 6:
                return critRate;
            case 7:
                return critDamage;
            case 8:
                return elementalMastery;
            case 9:
                return energyRecharge;
            case 10:
                return flatDEF;
            default:
                return null;
        }
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public PossibleUpgradeFunction getPossibleUpgradeFunction() {
        return possibleUpgradeFunction;
    }

    public void setPossibleUpgradeFunction(PossibleUpgradeFunction possibleUpgradeFunction) {
        this.possibleUpgradeFunction = possibleUpgradeFunction;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public SetValueFunction getSetValueFunction() {
        return setValueFunction;
    }

    public void setSetValueFunction(SetValueFunction setValueFunction) {
        this.setValueFunction = setValueFunction;
    }
}
